Repository navigation
gotc: tc monitor, live and from a file (increment 14) - #348
Merged
Merged
Conversation
…023) Move rtnl_listen, rtnl_from_file, print_timestamp, the replay clock and the capture's notification split out of goip into internal/nlmon, so gotc's tc monitor can use them. goip keeps thin adapters and its exit sentinels. New: MSG_TRUNC handling as rtnl_listen has it, the unicast echo of an NLM_F_ECHO request left out of a replay, and glibc's strerror text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (14C, V024) 27 rows: tc monitor live under a new helper that waits for the RTNLGRP_TC subscription, runs a trigger and stops the monitor with SIGTERM; tc monitor file over records built from corpus messages; and the refusals. Two batches agree once stamps are masked. The captures confirm the MO4-MO7, MO9, MO10 leads and found K23, a kernel bug that empties every matchall add event (recorded only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TcEventKind names a monitor event's tc object as accept_tcmsg dispatches it. TestWsTcMonitor decodes every event in ws/tcmonitor, live and in the record files, and pins K20, K22, K23 and MO5's event sizes. BenchmarkWsTcMonitor, and a tcmonitor case for nlmon's BenchmarkNotifications. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tc monitor subscribes to RTNLGRP_TC, runs ll_init_map on the subscription and hands each event to the printers; tc monitor file F walks raw records with no ll_init_map. -timestamp and -tshort stamp each event; -j stays text as in tc. The qdisc and action printers gain tc's event words, and action its tab_flush. nlmon records each message's datagram offset and replays through rtnl_listen's 16 KiB buffer, so a capture's oversized event is "Truncated message" as tc saw it. All 27 tcmonitor rows replay exactly with stamps masked; 12 mutants killed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…B, DOC007) New docs/netlink/upstream/iproute2-tc-monitor.md, not submitted to netdev. MO1-MO14 are confirmed against v7.2.0 and the tcmonitor corpus; MO5's lead is corrected to 2040 ops. MO15 (tab_flush outlives its flush) and MO16 (a -force batch stops at a missing monitor file but goes past a corrupt one) are added, with K19-K23, K23 being the matchall `*arg = head` kernel bug. Every finding is present at HEAD. Two TestGotcMonitorUnit rows pin MO16. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gotc monitor and tc monitor side by side on the workbench, both subscribed at once and fed by one trigger for every live row, then the offline and refusal rows: 27 of 27 identical once stamps are masked, MO5's Truncated message and exit 2 included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s (14V, V028) Two P2 review findings on PR 348: - xtcp2-nl-tcmon ran the trigger once the monitor's socket showed the RTNLGRP_TC bit. tc runs ll_init_map's link dump on that socket after the bind, and rtnl_dump_filter drops non-dump messages, so early events could be lost while the until-EREs still matched. The helper now also waits for Dump 0, Rmem 0 and a monitor thread blocked in recvmsg(2), i.e. rtnl_listen. The hermetic check gains 4 rows. The recorded corpus has no tc message before the dump's DONE; TestGotcMonitorCorpus now checks that for each live row. - nlmon.ReadFile read the whole file before walking it, and mapped read errors to ErrOpen, which ended a -force batch. FromFile is now rtnl_from_file's loop over an io.Reader (records handed on as read, one reused 16384-byte buffer). Read failures are ErrRead with "rtnl_from_file: fread: <strerror>" and return -1, as tc 7.2.0 does (checked on the host for a directory, plain and under -force -batch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Increment 14:
tc monitorandtc monitor file Fin gotc. Six tasks, one commit each, each recorded indocs/netlink/gotc-status.md(V023–V027, DOC007).internal/nlmonholds whatip monitorandtc monitorshare: rtnl_listen, rtnl_from_file, print_timestamp, a replay clock, and the split of a capture into its startup dump and its events. goip now uses it, and its monitor tests pass. One text change:Cannot fopennow prints glibc's capitalised strerror, asipdoes.tcmonitorspace of 27 rows (13 live, 8 from a file, 7 refusals) and a newxtcp2-nl-tcmonhelper with a hermetic check (nlcap-tcmon). Two batches on one boot agree once stamps are masked.xtcpnl.TcEventKind. Every event in the corpus decodes with no problem through the existing tc parsers. Benchmark numbers are in V025.tc monitor(V026): live on RTNLGRP_TC, or from a file, with-timestamp/-tshort. The qdisc and action printers gain the event words tc prints (added/replaced/deleted,Added action,Flushed table, ...).nlmon.Replayapplies rtnl_listen's 16 KiB buffer to replays, so a replay truncates where tc did. All 27 rows replay exactly once stamps are masked. Coverage: gotc 85.2%, nlmon 91.4%. All 12 mutants are killed.docs/netlink/upstream/iproute2-tc-monitor.md, not submitted to netdev. MO1–MO16 and kernel notes K19–K23. Every finding is present at upstream HEAD.Truncated messagewith exit 2 included.Notable findings
mall_changeends with*arg = headwhere it should benew(cls_matchall.c:233, since fd62d9f5c575). So every matchall add event has handle 0 and no options. Recorded only.added/replacednever print, because qdisc_notify never sends NLM_F_CREATE.-j monitorprints text.tab_flush, andexit()againstreturn -1under-force.Test plan
go test ./...nix build .#checks.x86_64-linux.test-go-racenix build .#gotc .#goip .#test-go-unitat the commit🤖 Generated with Claude Code